
class User{
  int id;
  String username;
  String name;
  String password;
  String token;
  int sex;
  String birthDate;
  String phone;
  String address;
  String avatar;
  String degree;
  String title;//职称
  List<dynamic> skills;//擅长专业
  String hospital;//执业医院
  int status;//认证状态
  String role;//角色
  //认证信息

  CertificationInfo certificationInfo;


  @override
  String toString() {
    return 'User{id: $id, username: $username, name: $name, password: $password, token: $token, sex: $sex, birthTime: $birthDate, phone: $phone, address: $address, avatar: $avatar, degree: $degree, title: $title, skills: $skills, hospital: $hospital, status: $status, role: $role, certificationInfo: $certificationInfo}';
  }

  User.fromJsonMap(Map<String, dynamic> map):
        id = map["id"],
        username = map["username"],
        name = map["username"],
        password = map["password"],
        token = map["token"],
        sex = map["sex"],
        birthDate = map["birthDate"],
        phone = map["mobile"],
        address = map["address"],
        avatar = map["avatar"],
        degree = map["education"],
        skills = map["expertise"],
        title = map["doctorTitle"],
        hospital = map["clinicName"],
        status = map["status"],
        role = map["role"],
        certificationInfo = CertificationInfo.parseJson(map["doctorCertificateVO"]);

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = id;
    data['username'] = username;
    data['name'] = name;
    data['password'] = password;
    data['token'] = token;
    data['sex'] = sex;
    data['birthDate'] = birthDate;
    data['mobile'] = phone;
    data['address'] = address;
    data['avatar'] = avatar;
    data['education'] = degree;
    data['expertise'] = skills;
    data['doctorTitle'] = title;
    data['clinicName'] = hospital;
    data['role'] = role;
    data['status'] = status;
    if(certificationInfo!=null)
      data['doctorCertificateVO'] = certificationInfo.toJson();
    return data;
  }
}

class CertificationInfo{

  String credentialsNo;//资格证书编号
  String practiceNo;//执业证书编号

  List<dynamic> credentialsImg;//资格证书照片
  List<dynamic> practiceImg;//执业证书照片
  List<dynamic> titleImg;//职称照片


  static CertificationInfo parseJson(Map<String, dynamic> map){
    if(map==null){
      return null;
    }
    return CertificationInfo.fromJsonMap(map);
  }


  CertificationInfo.fromJsonMap(Map<String, dynamic> map):

        credentialsNo = map["certifiedNo"],
        practiceNo = map["qualificationNo"],

        credentialsImg = map["certifiedPic"],
        practiceImg = map["qualificationPic"],
        titleImg = map["titlePic"];


  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['certifiedNo'] = credentialsNo;
    data['qualificationNo'] = practiceNo;
    data['certifiedPic'] = credentialsImg;
    data['qualificationPic'] = practiceImg;
    data['titlePic'] = titleImg;
    return data;
  }

  @override
  String toString() {
    return 'CertificationInfo{credentialsNo: $credentialsNo, practiceNo: $practiceNo, credentialsImg: $credentialsImg, practiceImg: $practiceImg, titleImg: $titleImg}';
  }
}